package com.linkage.jz.bankruptcy.bean.Vote;

import android.text.TextUtils;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @author AFAP
 * 表决人详情
 */
public class VoterDetail {
    private String id; // 参会表决人记录id
    private String sysUserId; // 用户id
    private String bankruptcyProjectId; // 项目id
    private String voteId; // 表决id
    private String creditorId; // 债权人id
    private String creditorName; // 债权人名称
    private String groupId; // 分组id
    private double confirmedMoney; // 确认金额voteOpinion
    private String meetingNumber; // 参会编号
    private int voteOpinion; // 表决意见 0反对1赞成
    private double voteMoney; // 表决金额
    private boolean meeting; // 是否参会
    private boolean vote; // 是否表决

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    private String avatar;
    private boolean allowChange; // 是否允许修改
    private String supplementOpinion; // 表决补充意见
    private long voteTime; // 表决时间
    private int onlineStatus;// 0-未知 1-线上 2-线下


    // 额外附加信息
    private boolean lastOne = false; // 是否是最后一个元素
    private boolean canLoadMore = false; // 是否有更多

//    参会时间	meetingTime	Long	是	时间戳
//    	supplementOpinion	String	是	文字描述补充意见
//    债权人头像	avatar	String	是


    public String getCreditorName() {
        return creditorName;
    }

    public void setCreditorName(String creditorName) {
        this.creditorName = creditorName;
    }

    public String getBankruptcyProjectId() {
        return bankruptcyProjectId;
    }

    public void setBankruptcyProjectId(String bankruptcyProjectId) {
        this.bankruptcyProjectId = bankruptcyProjectId;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public String getVoteId() {
        return voteId;
    }

    public void setVoteId(String voteId) {
        this.voteId = voteId;
    }

    public double getConfirmedMoney() {
        return confirmedMoney;
    }

    public void setConfirmedMoney(double confirmedMoney) {
        this.confirmedMoney = confirmedMoney;
    }

    public String getMeetingNumber() {
        return meetingNumber;
    }

    public void setMeetingNumber(String meetingNumber) {
        this.meetingNumber = meetingNumber;
    }

    public int getOnlineStatus() {
        return onlineStatus;
    }

    public void setOnlineStatus(int onlineStatus) {
        this.onlineStatus = onlineStatus;
    }

    public long getVoteTime() {
        return voteTime;
    }

    public void setVoteTime(long voteTime) {
        this.voteTime = voteTime;
    }

    public int getVoteOpinion() {
        return voteOpinion;
    }

    public void setVoteOpinion(int voteOpinion) {
        this.voteOpinion = voteOpinion;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getSysUserId() {
        return sysUserId;
    }

    public void setSysUserId(String sysUserId) {
        this.sysUserId = sysUserId;
    }

    public double getVoteMoney() {
        return voteMoney;
    }

    public void setVoteMoney(double voteMoney) {
        this.voteMoney = voteMoney;
    }

    public boolean isMeeting() {
        return meeting;
    }

    public void setMeeting(boolean meeting) {
        this.meeting = meeting;
    }

    public boolean isVote() {
        return vote;
    }

    public void setVote(boolean vote) {
        this.vote = vote;
    }

    public String getCreditorId() {
        return creditorId;
    }

    public void setCreditorId(String creditorId) {
        this.creditorId = creditorId;
    }

    public boolean isAllowChange() {
        return allowChange;
    }

    public void setAllowChange(boolean allowChange) {
        this.allowChange = allowChange;
    }

    public String getSupplementOpinion() {
        return supplementOpinion;
    }

    public void setSupplementOpinion(String supplementOpinion) {
        this.supplementOpinion = supplementOpinion;
    }

    public boolean isLastOne() {
        return lastOne;
    }

    public void setLastOne(boolean lastOne) {
        this.lastOne = lastOne;
    }

    public boolean isCanLoadMore() {
        return canLoadMore;
    }

    public void setCanLoadMore(boolean canLoadMore) {
        this.canLoadMore = canLoadMore;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof VoterDetail) {
            return TextUtils.equals(this.getId(), ((VoterDetail) obj).getId());
        }
        return false;
    }

    public static List<VoterDetail> parse(JsonArray arr) {
        List<VoterDetail> list = new ArrayList<>();
        for (int i = 0; i < arr.size(); i++) {
            list.add(parse(arr.get(i).getAsJsonObject()));
        }
        return list;
    }

    public static VoterDetail parse(JsonObject obj) {
        VoterDetail bean = new Gson().fromJson(obj, VoterDetail.class);
        return bean;
    }
}
